﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Decorator_观察者_模式
{
    #region 原始行为
    public interface IMedia
    {
        void Play();
    }
    public abstract class VideoMedia : IMedia
    {
        public abstract void Play();
    }
    public class RM : VideoMedia
    {

        public override void Play()
        {
            Console.WriteLine("RM play media");
        }
    }
    public class RMVB : VideoMedia
    {
        public override void Play()
        {
            Console.WriteLine("RMVB play media");
        }
    }
    #endregion

    #region 装饰器
    public abstract class VideoDecorator : VideoMedia
    {
        protected VideoMedia Video { get; private set; }
        public VideoDecorator(VideoMedia videoMedia)
        {
            Video = videoMedia;
        }
    }
    public class CopyRightVideoDecorator : VideoDecorator
    {
        public CopyRightVideoDecorator(VideoMedia viewMedia)
            : base(viewMedia)
        {

        }
        public override void Play()
        {
            Console.WriteLine("版本号为:1.0.0");
            Video.Play();
        }
    }
    #endregion
    class Program
    {
        static void Main(string[] args)
        {
            VideoDecorator videoDecorator = new CopyRightVideoDecorator(new RM());
            videoDecorator.Play();
        }
    }
}
